package com.nnnu.orange.pojo.vo;

import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;

@Data
public class PayBorrowingVO {
    private LocalDateTime borrowDate, dueDate, returnDate;
    private Integer status;
    private String notes;
    private Long day;

    public Long getDay() {
        return this.getStatus() == 0 ? ChronoUnit.DAYS.between(this.getDueDate().toLocalDate(),
                this.getReturnDate() == null ? LocalDate.now() : this.getReturnDate().toLocalDate()) : 0;
    }
}
